/**
 * @description 路由守卫，目前两种模式：all模式与intelligence模式
 */
// import { useUserStore } from '@/store/modules/user'
// import { useRoutesStore } from '@/store/modules/routes'
// import { useSettingsStore } from '@/store/modules/settings'
import VabProgress from 'nprogress'
import 'nprogress/nprogress.css'
import getPageTitle from '@/utils/pageTitle'
// import { toLoginRoute } from '@/utils/routes'
// import {
//   authentication,
//   loginInterception,
//   routesWhiteList,
//   supportVisit,
// } from '@/config'
import { Router } from 'vue-router'

export function setupPermissions(router: Router) {
  VabProgress.configure({
    easing: 'ease',
    speed: 500,
    trickleSpeed: 200,
    showSpinner: false,
  })

  router.beforeEach(async (to: { path: string }, from: any, next: any) => {
    next()
  })
  router.afterEach((to: any) => {
    document.title = getPageTitle(to.meta.title)
    if (VabProgress.status) VabProgress.done()
  })
}
